import 'package:flutter/material.dart';
import 'package:xindong/manager/xindong_page_singleton.dart';
import 'package:xindong/manager/xindong_user_controller.dart';
import 'package:xindong/models/xindong_setting_class.dart';
import 'package:xindong/routes/tab_mine/view/xindong_wode_item_cell.dart';
import 'package:xindong/routes/user/wallet/xindong_wallet_account_yemian.dart';
import 'package:xindong/widgets/common/xindong_app_bar.dart';
import 'package:xindong/widgets/container/xindong_fenzu_container.dart';

class XinDongSecurityYeMian extends StatelessWidget {
  const XinDongSecurityYeMian({Key? key}) : super(key: key);

  void onTap(XinDongSettingClass model) {
    switch (model.type) {
      case SettingType.ant:
        XinDongPageSingleton.instance.pushYeMian(const XinDongWalletAccountYeMian());
        break;
      case SettingType.address:
        break;
      default:
        break;
    }
  }

  @override
  Widget build(BuildContext context) {
    final dataList = [
      [
        XinDongSettingClass(
            type: SettingType.phone,
            title: "手机号码",
            content: "${XinDongUserController.to.userInfo?.phone}",
            enable: false),
        XinDongSettingClass(type: SettingType.ant, title: "设置支付宝"),
        // XinDongSettingClass(type: SettingType.address, title: "我的地址"),
      ]
    ];
    return Scaffold(
      appBar: XinDongAppBar("账号与安全"),
      body: XinDongGroupSectionContainer(
        dataList: dataList,
        itemBuilder: (BuildContext context, int section, int index, data) {
          XinDongSettingClass model = data;
          return XinDongWoDeItemWidget(model: model, onTap: () => onTap(model));
        },
      ),
    );
  }
}
